package com.wu.springbootwebsocket.config;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright
 *
 * @Author WuHuang
 * @Date 2023/1/5
 */
@RestController
public class TestController {

    @Autowired
    private WebSocket webSocket;

    @GetMapping("add")
    public void add() {
        String users = "{\n" +
                "  \"serialVersionUID\": 1,\n" +
                "  \"name\": \"demoData\",\n" +
                "  \"userName\": \"demoData\",\n" +
                "  \"password\": \"demoData\",\n" +
                "  \"isAdmin\": \"demoData\",\n" +
                "  \"roleId\": 1,\n" +
                "  \"lastLoginIp\": \"demoData\",\n" +
                "  \"status\": 1,\n" +
                "  \"createId\": 1\n" +
                "}";
        webSocket.sendMessage(JSONObject.toJSONString(users));

    }


}
